﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="database.DAO, golf.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>게임방 생성</title>
</head>
<%
	DAO dao = DAO.getInstance();
	int serverNo = (Integer)session.getAttribute("serverNo");
	int charNo = (Integer)session.getAttribute("charNo");
	String accountID = (String)session.getAttribute("accountID");
	Account account = dao.getAccount(accountID);
	ProductService ps = dao.getProductService(account.getPs_no());
	Course[] courses = dao.getCourseList();
	
	//Character character = dao.getCharacter(charNo);
	
%>
<body>

<h1>게임방 생성</h1>
<form name="form1" method="post" action="../post/postCreateGame.jsp">
    <table border="1" cellspacing="0" bordercolordark="white" bordercolorlight="black" width="68%">
        <tr>
            <td width="188">
                <p><span style="font-size:9pt;">방이름</span></p>
            </td>
            <td width="295">
                <p><span style="font-size:9pt;"><input type="text" name="roomName" maxlength="5" size="5"></span></p>
            </td>
        </tr>
        <tr>
            <td width="188">
                <p><span style="font-size:9pt;">코스</span></p>
            </td>
            <td width="295"><span style="font-size:9pt;"><select name="course" size="1">
            	<%for( int i = 0; i < courses.length; i++ ){ %>
                    <option value="<%=courses[i].getNo() %>"><%= courses[i].getName()%></option>
                <%}%>
</select></span></td>
        </tr>
        <tr>
            <td width="188">
                <p><span style="font-size:9pt;">경기방식</span></p>
            </td>
            <td width="295"><span style="font-size:9pt;">
            	<select name="type" size="1">
                    <option value="<%=Room.Game.GAMETYPE_STROKE%>"><%=Room.Game.GAMETYPE_STROKE%></option>
                    <option value="<%=Room.Game.GAMETYPE_SCRATCH%>"><%=Room.Game.GAMETYPE_SCRATCH%></option>
                    <option value="<%=Room.Game.GAMETYPE_SKINS%>"><%=Room.Game.GAMETYPE_SKINS%></option>
                    <option value="<%=Room.Game.GAMETYPE_MATCH%>"><%=Room.Game.GAMETYPE_MATCH%></option>
				</select></span></td>
        </tr>
        <tr>
            <td width="188">
                <p><span style="font-size:9pt;">스킨스/스크라치 옵션(홀 당 판돈)<br>(해당게임이 아닌 경우 무시)</span></p>
            </td>
            <td width="295">
                <p><span style="font-size:9pt;">
                <%//골드나 골드플러스 등급이 아닌 경우 3개 판돈 중 1개 선택
                if(ps==null || (ps.getGrade_name().compareTo("골드") != 0 &&
                		ps.getGrade_name().compareTo("골드플러스") != 0) ) {%>
	                <select name="enzi" size="1">
	                    <option value="10000">10000</option>
	                    <option value="20000">20000</option>
	                    <option value="30000">30000</option>
					</select></span></p>
				<%} //골드, 골드플러스 등급의 경우 마음대로 가격 설정가능
                else if( ps != null && (ps.getGrade_name().compareTo("골드") == 0 ||
                		ps.getGrade_name().compareTo("골드플러스") == 0)) {%>
                <p><span style="font-size:9pt;"><input type="text" name="enzi" maxlength="5" size="5"></span></p>
                <%}%>
            </td>
        </tr>
        <tr>
            <td width="188">
                <p><span style="font-size:9pt;">레벨제한</span></p>
            </td>
            <td width="295">
                <p><span style="font-size:9pt;"><input type="text" name="lvl" maxlength="5" size="5"></span></p>
            </td>
        </tr>
        <tr>
            <td width="188">
                <p><span style="font-size:9pt;">라운딩홀수</span></p>
            </td>
            <td width="295">
                <p><span style="font-size:9pt;"><select name="numOfHoles" size="1">
                    <option value="1">1</option>
                    <option value="3">3</option>
                    <option value="6">6</option>
                    <option value="9">9</option>
                    <option value="18">18</option>
</select></span></p>
            </td>
        </tr>
        <tr>
            <td width="188">
                <p><span style="font-size:9pt;">인원제한</span></p>
            </td>
            <td width="295">
                <p><span style="font-size:9pt;"><input type="text" name="howmany" maxlength="5" size="5"></span></p>
            </td>
        </tr>
        <tr>
            <td width="188">
                <p><span style="font-size:9pt;">비밀번호</span></p>
            </td>
            <td width="295">
                <p><span style="font-size:9pt;"><input type="text" name="pw" maxlength="5" size="5"></span></p>
            </td>
        </tr>
    </table>
    <p><input type="submit" name="action" value="createRoom"></p>
</form>
<p>&nbsp;</p>
<p>대기방으로 들어가기..</p>
<p>&nbsp;</p>
</body>

</html>